package spring.cloud.tasks.client.item_task_processor.task_items_processor.task_data_processor;

import spring.cloud.tasks.client.item_task_processor.TaskItemAndParameter;

import java.util.Comparator;
import java.util.List;


public abstract class TaskDataProcessor<TaskData> {
    public abstract String getTaskId();

    public abstract List<TaskData> getTaskDataList(//
                                                   String taskParameter,//
                                                   List<TaskItemAndParameter> taskItemAndParameterList, //
                                                   int taskItemNum,//
                                                   int eachFetchDataNum//
                                                   //
    ) throws Exception;//

    public abstract Comparator<TaskData> getComparator();

    //
    public abstract boolean execute(TaskData[] taskData) throws Exception;

    public abstract boolean execute(TaskData task) throws Exception;

    /**
     * 实现内需要约定处理多少数据量就向ZK进行汇报task item心跳
     */
    public abstract void updateTaskItemCurrentProcessorProgressInfoAtTaskProgressThread();
}
